﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CafeOnline.MvcFramework.Configuration {
    [ConfigurationCollection(typeof(CatalogConfigurationElement), AddItemName = "catalog")]
    public class CatalogConfigurationElementCollection : ConfigurationElementCollection {
        #region Methods
        /// <summary>
        /// Gets a unique key for the given element.
        /// </summary>
        /// <param name="element">The element to get a key for.</param>
        /// <returns>A unique key for the given element.</returns>
        protected override object GetElementKey(ConfigurationElement element) {
            return ((CatalogConfigurationElement)element).Name;
        }

        /// <summary>
        /// Creates a new instance of <see cref="CatalogConfigurationElement" /> for use with this collection.
        /// </summary>
        /// <returns>A new instance of <see cref="CatalogConfigurationElement" />.</returns>
        protected override ConfigurationElement CreateNewElement() {
            return new CatalogConfigurationElement();
        }
        #endregion
    }
}
